package br.mikhas.container.config.convertion;

import br.mikhas.util.TypeUtils;

/**
 * Convert java primitive types but numbers
 * 
 * @author Mikhail Domanoski
 * 
 */
public class JavaPrimitivesConverter implements Converter {

	/**
	 * Accepts java primitive types including <code>void</code> and
	 * <code>String</code>.
	 */
	@Override
	public boolean accepts(Class<?> type) {
		return TypeUtils.isPrimitive(type) || TypeUtils.isWrapper(type);
	}

	@Override
	public Object convert(String literalValue, Class<?> type) {
		return TypeUtils.convertToType(type, literalValue);
	}

}
